<template>
    <ul class="latter-list">
        <li v-for="letter of letters"
        :key="letter" class="letter"
        @click="handleLetterClick">
            {{letter}}
        </li>
    </ul>
</template>

<script>
    export default {
        name: "Letter",
        props: {
            allCity:Object
        },
        computed: {
            letters () {
                const letters = []
                for (let i in this.allCity) {
                    letters.push(i)
                }
                return letters
            }
        },
        mounted () {

        },
        methods: {
            handleLetterClick (e) {
                this.$emit('changeLetter',e.target.innerText)
            }
        }
    }
</script>

<style lang="stylus" scoped>
    .latter-list
        position :absolute
        right :0
        top: 150px
        width :30px
        .letter
            font-size: 14px
            line-height: 20px
            color : $MainColor
            text-align :right
            padding-right :5px
</style>
